<?php

use App\Models\Category;
use Illuminate\Support\Facades\Auth;

return [
    'title' => '分类',
    'single' =>'分类',
    'model' => Category::class,

    //CRUD权限进行单独控制，其他权限默认通过
    'action_permission' =>[
        'delete' => function () {
            //只允许站长删除
            Auth::user()->hasRole('Founder');
        },
    ],
    'columns'=>[
        'id' =>[
            'title' => 'ID',
        ],
        'name' =>[
            'title' => '名称',
        ],
        'description' =>[
            'title' => '描述',
        ],
        'operation'=>[
            'title' => '管理',
        ],
    ],
    'edit_fields' =>[
        'name'=>[
            'title' => '名称',
        ],
        'description' =>[
            'title' => '描述',
            'type' => 'textarea',
        ],
    ],
    'filters' =>[
        'id' => [
            'title' => '分类ID',
        ],
        'name'=>[
            'title' => '名称',
        ],
        'description' =>[
            'title' => '描述',
        ],
    ],
    'rules' =>[
        'name'=>'required|min:1|unique:categories',
    ],
    'messages' =>[
        'name.unique' => '分类名在数据库里有重复，请选用其他名称。',
        'name.required' => '请确保名字至少一个字符以上',
    ]
];
